<?php

// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免费声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\api\controller\wallpaper;

use app\api\controller\Base;
use \think\facade\Db;

/**
 * 小鲸鱼
 */
class Recommend extends Base
{
    protected $table = 'app_wallpaper_tag';

    /**
     * 有课登录
     */
    public function index()
    {

        $res = simlist($this->table,'id,name',['status'=>1]);
        foreach($res as &$value){
            $value['list'] = Db::table("app_wallpaper")->field("id,title,url,thumbnail")->where([['tag_id','=',$value['id']]])->limit(5)->select()->toArray();
        }
        $this->success('success', $res);
    }
}
